import config
'''
    拼装json
'''
def jsonMade(code,data,msg):
    data = {
        'code':code,
        'data':data,
        'msg':msg
    }
    return data

'''
    验证数据是否存在
'''
def checkIdExist(id):
    cursor = config.db.cursor()
    sql = "select count(*) from user where id = {}".format(id)
    cursor.execute(sql)
    data = cursor.fetchone()[0]
    if str(data) == '1':
        return True
    else:
        return False